package com.youth.mq.consumer;

import com.youth.mq.MyProcessor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.messaging.handler.annotation.SendTo;

/**
 * @ClassName OrderStreamTransformer
 * @Description: TODO
 * @Author yjwu
 * @Date 2020/3/14 16:57
 **/
@EnableBinding(MyProcessor.class)
//@EnableBinding(value = {MySink.class, MySource.class})
@Slf4j
public class OrderStreamTransformer {
//    @ServiceActivator(inputChannel = MyProcessor.INPUT,outputChannel = MyProcessor.OUTPUT)

    @StreamListener(MyProcessor.MESSAGE_INPUT)
    @SendTo(MyProcessor.MESSAGE_OUTPUT)
    public Object transform(Object payload) {
        log.info("消息中转站:{}", payload.toString());
        return "「" + payload + "」";
    }
}
